require("lualib_bundle");
__TS__SourceMapTraceBack(debug.getinfo(1).short_src, {["4"] = 1,["5"] = 1,["6"] = 3,["7"] = 3,["8"] = 3,["10"] = 15,["11"] = 16,["12"] = 17,["13"] = 14,["14"] = 21,["15"] = 23,["16"] = 24,["18"] = 25,["19"] = 25,["20"] = 26,["21"] = 26,["22"] = 26,["23"] = 26,["24"] = 26,["25"] = 27,["26"] = 28,["27"] = 25,["30"] = 30,["31"] = 31,["32"] = 32,["33"] = 33,["35"] = 35,["36"] = 35,["37"] = 35,["38"] = 35,["39"] = 35,["40"] = 37,["41"] = 38,["42"] = 39,["43"] = 21,["44"] = 46,["45"] = 47,["46"] = 48,["47"] = 49,["48"] = 50,["49"] = 51,["51"] = 53,["52"] = 54,["54"] = 56,["55"] = 56,["56"] = 56,["57"] = 56,["58"] = 56,["59"] = 58,["60"] = 59,["61"] = 60,["62"] = 61,["63"] = 61,["64"] = 61,["65"] = 61,["66"] = 61,["67"] = 62,["68"] = 62,["69"] = 62,["70"] = 62,["71"] = 62,["73"] = 46,["74"] = 8,["75"] = 3});
local ____exports = {}
local ____dialog = require("solar.w3ts.handles.dialog")
local DialogButton = ____dialog.DialogButton
____exports.default = __TS__Class()
local GameDifficultyChooseDialogState = ____exports.default
GameDifficultyChooseDialogState.name = "GameDifficultyChooseDialogState"
function GameDifficultyChooseDialogState.prototype.____constructor(self)
    local triggerHandle = CreateTrigger()
    TriggerRegisterTimerEventSingle(triggerHandle, 0.5)
    TriggerAddAction(triggerHandle, ____exports.default.action)
end
function GameDifficultyChooseDialogState.action()
    local dialog = DialogCreate()
    DialogSetMessage(dialog, "难度选择")
    do
        local i = 1
        while i <= 9 do
            local button = DialogAddButton(
                dialog,
                ("难度" .. tostring(i)) .. "",
                0
            )
            DialogButton:fromHandle(button).solarData.GameDifficulty = i
            DialogButton:fromHandle(button).solarData.isEndlessMode = false
            i = i + 1
        end
    end
    if ____exports.default.config.hasEndlessMode then
        local button = DialogAddButton(dialog, "无尽模式", 0)
        DialogButton:fromHandle(button).solarData.GameDifficulty = 4
        DialogButton:fromHandle(button).solarData.isEndlessMode = true
    end
    DialogDisplay(
        Player(0),
        dialog,
        true
    )
    local ydl_trigger = CreateTrigger()
    TriggerRegisterDialogEvent(ydl_trigger, dialog)
    TriggerAddAction(ydl_trigger, ____exports.default.on_dialog_click)
end
function GameDifficultyChooseDialogState.on_dialog_click()
    local button = GetClickedButton()
    local gameDifficultyTemp = DialogButton:fromHandle(button).solarData.GameDifficulty
    local isEndlessModeTemp = DialogButton:fromHandle(button).solarData.isEndlessMode
    if gameDifficultyTemp then
        gameDifficulty = gameDifficultyTemp
    end
    if isEndlessModeTemp then
        isEndlessMode = isEndlessModeTemp
    end
    DisplayTimedTextToForce(
        GetPlayersAll(),
        15,
        "|CFFFF0000选择的难度 ： 难度" .. tostring(gameDifficulty)
    )
    if ____exports.default.config.AddPlayerTechId and #____exports.default.config.AddPlayerTechId > 3 then
        local techLv = gameDifficulty - 1
        techLv = techLv * techLv
        AddPlayerTechResearched(
            Player(11),
            FourCC(____exports.default.config.AddPlayerTechId),
            techLv
        )
        AddPlayerTechResearched(
            Player(12),
            FourCC(____exports.default.config.AddPlayerTechId),
            techLv
        )
    end
end
GameDifficultyChooseDialogState.config = {hasEndlessMode = false, AddPlayerTechId = "qbk1"}
____exports.default = GameDifficultyChooseDialogState
return ____exports
